# 您是一个数据分析师，现在您有一个包含公司员工个人信息的字典`employees`，其中每个键表示一个员工ID，对应的值是一个包含姓名、年龄、性别、职位、项目组和薪资历史列表的字典。
#
# 员工信息的示例如下：
employees = {
    101: {
        "name": "Alice",
        "age": 30,
        "gender": "Female",
        "position": "Data Scientist",
        "team": "Research",
        "salary_history": [70000, 80000, 90000]
    },
    # 更多员工数据...
}



# 需要进行以下操作：
#
# 1. 新增一个员工的信息到`employees`字典中。
# employees[102] = {
#     "name": "Bob",
#     "age": 20,
#     "gender": "Male",
#     "position": "Data Engineer",
#     "team": "Engineering",
#     "salary_history": [60000, 70000, 80000]
# }
# employees[103] = {
#     "name": "Charlie",
#     "age": 26,
#     "gender": "Male",
#     "position": "Data Analyst",
#     "team": "Analytics",
#     "salary_history": [65000, 75000,20000]
# }
# 2. 删除一个指定的员工的信息。
# del employees[101]
# 3. 更新员工101的年龄至31。
# employees[101]["age"] = 31
# 4. 增加员工101薪资历史中的最新薪资至95000。
# employees[101]["salary_history"].append(95000)
# 5. 计算员工101的平均薪资。
# average_salary = sum(employees[101]["salary_history"]) / len(employees[101]["salary_history"])
# print(average_salary)
# 6. 找出所有年龄大于25岁的员工的姓名和ID。
# for employee_id, employee_info in employees.items():
#     if employee_info["age"] > 25:
#         print(f"Employee ID: {employee_id}, Name: {employee_info['name']}")
# 7. 对`employees`中的每个员工，添加'bonus'键至其字典中，其中值是最新薪资的10%。
# for employee_id, employee_info in employees.items():
#     bonus = employee_info["salary_history"][-1] * 0.1
#     employee_info["bonus"] = bonus
# 8. 将员工101的职位更新为"Senior Data Scientist"。
# employees[101]["position"] = "Senior Data Scientist"
# 9. 从员工的信息中移除`gender`键。
# for employee_id, employee_info in employees.items():
#     if "gender" in employee_info:
#         del employee_info["gender"]
# 10. 创建一个新的嵌套字典，该字典仅包含员工的`name`和`position`。
# nested_dict = {employee_id: {
#     "name": employee_info["name"],
#     "position": employee_info["position"]
# } for employee_id, employee_info in employees.items()}
# 需要编写Python代码来执行上述任务，并请确保你的代码可以适用于任何员工人数和任何符合上述格式的员工信息。

# print(nested_dict)
print(employees)